package cn.signalpha.modules.shop.vo;

import cn.signalpha.core.swagger.ApiModelPropertyEnum;
import cn.signalpha.core.tool.utils.DateUtil;
import cn.signalpha.modules.shop.entity.UserAddress;
import cn.signalpha.modules.shop.entity.enums.CouponUseTypeEnum;
import cn.signalpha.modules.shop.entity.enums.LogisticsTypeEnum;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 所有商户订单合并
 */
@Data
public class OrderConfirmVO implements Serializable{
	private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "实际支付")
    private Double orderPriceTotal;
    @ApiModelProperty(value = "商品总价")
    private Double goodsPriceTotal;
    @ApiModelProperty(value = "商品总数")
    private Integer goodsNumTotal;
	@ApiModelProperty(value = "总运费")
	private Double transportFee;
    @ApiModelProperty(value = "地址")
    private UserAddress userAddress;
	@ApiModelProperty(value = "余额抵扣")
	private Double deductMoney;
	@ApiModelProperty(value = "积分抵扣")
	private Double deductIntegral;
	@ApiModelProperty(value = "积分金额")
	private Double deductIntegralMoney;
    @ApiModelProperty(value = "商户优惠券抵扣")
    private Double deductCouponSeller;
	@ApiModelProperty(value = "平台优惠券抵扣")
	private Double deductCouponSystem;
	@ApiModelProperty(value = "营销活动优惠金额")
	private Double deductPublicity;
	@ApiModelProperty(value = "营销活动优惠详情")
	private List<Map<String, Object>> deductPublicityDetail;
    @ApiModelProperty(value = "平台可用的优惠券列表")
    private List<CouponVO> couponsList;
	@ApiModelProperty(value = "平台不可用的优惠券列表")
	private List<CouponVO> couponNotList;
	@ApiModelProperty(value = "每个商户的购物车信息")
	private List<SellerCartVO> sellerCartList;

	@Data
	public static class SellerCartVO implements Serializable{
		private static final long serialVersionUID = 1L;
		@ApiModelProperty(value = "商户id")
		private Long sellerId;
		@ApiModelProperty(value = "商户名称")
		private String sellerName;
		@ApiModelProperty(value = "商户logo")
		private String sellerLogo;
		@ApiModelProperty(value = "是否开启自提")
		private Integer sellerIsOpenPick;
		@ApiModelProperty(value = "商户的自提配置")
		private List<SellerPickConfigVO> sellerPickConfigList;
		@ApiModelProperty(value = "是否开启同城配送")
		private Integer sellerIsOpenDelivery;
		@ApiModelProperty(value = "同城配送配置")
		private SellerDeliveryConfigVO sellerDeliveryConfig;
		@ApiModelProperty(value = "商户扩展信息")
		private SellerExtVO sellerExt;
		@ApiModelProperty(value = "订单编号")
		private String orderNo;
		@ApiModelProperty(value = "实际支付")
		private Double orderPriceTotal;
		@ApiModelProperty(value = "商品总价")
		private Double goodsPriceTotal;
		@ApiModelProperty(value = "商品总数")
		private Integer goodsNumTotal;
		@ApiModelProperty(value = "配送方式")
		@ApiModelPropertyEnum(LogisticsTypeEnum.class)
		private Integer logisticsType;
		@ApiModelProperty(value = "运费")
		private Double transportFee;
		@ApiModelProperty(value = "余额抵扣")
		private Double deductMoney;
		@ApiModelProperty(value = "积分抵扣")
		private Double deductIntegral;
		@ApiModelProperty(value = "积分金额")
		private Double deductIntegralMoney;
		@ApiModelProperty(value = "商户优惠券抵扣")
		private Double deductCouponSeller;
		@ApiModelProperty(value = "平台优惠券抵扣")
		private Double deductCouponSystem;
		@ApiModelProperty(value = "营销活动优惠金额")
		private Double deductPublicity;
		@ApiModelProperty(value = "营销活动优惠详情")
		private List<Map<String, Object>> deductPublicityDetail;
		@ApiModelProperty(value = "商户可用的优惠券列表")
		private List<CouponVO> couponsList;
		@ApiModelProperty(value = "商户不可用的优惠券列表")
		private List<CouponVO> couponNotList;
		@ApiModelProperty(value = "商品列表")
		private List<SellerCartItemVO> sellerCartItemList;
		@ApiModelProperty(value = "订单备注信息")
		private String remarks;
		@ApiModelProperty(value = "商家地址id，自提使用")
		private Long sellerAddressId;
		@ApiModelProperty(value = "配送日期 yyyy-MM-dd")
		private String deliveryDate;
		@ApiModelProperty(value = "配送开始时间 HH:mm")
		private String deliveryBeginTime;
		@ApiModelProperty(value = "配送结束时间 HH:mm")
		private String deliveryEndTime;
	}

	@Data
	public static class SellerCartItemVO implements Serializable {
		private static final long serialVersionUID = 1L;
		@ApiModelProperty(value = "购物车ID")
		private Long id;
		@ApiModelProperty(value = "商户ID")
		private Long sellerId;
		@ApiModelProperty(value = "商品id")
		private Long goodsId;
		@ApiModelProperty(value = "skuId")
		private Long goodsSkuId;
		@ApiModelProperty(value = "商品规格")
		private String goodsSpec;
		@ApiModelProperty(value = "商品类型")
		private Integer goodsType;
		@ApiModelProperty(value = "商品名称")
		private String goodsName;
		@ApiModelProperty(value = "商品状态")
		private Integer goodsStatus;
		@ApiModelProperty(value = "商品数量")
		private Integer goodsNum;
		@ApiModelProperty(value = "商品图")
		private String goodsImg;
		@ApiModelProperty(value = "商品价")
		private Double goodsPrice;
		@ApiModelProperty(value = "商品总价 = 商品价格 * 数量")
		private Double goodsTotalPrice;
		@ApiModelProperty(value = "余额抵扣")
		private Double deductMoney;
		@ApiModelProperty(value = "积分抵扣")
		private Double deductIntegral;
		@ApiModelProperty(value = "积分金额")
		private Double deductIntegralMoney;
		@ApiModelProperty(value = "商户优惠拳抵扣")
		private Double deductCouponSeller;
		@ApiModelProperty(value = "平台优惠拳抵扣")
		private Double deductCouponSystem;
		@ApiModelProperty(value = "营销活动抵扣")
		private Double deductPublicity;
		@ApiModelProperty(value = "营销活动ID")
		private Long deductPublicityId;
		@ApiModelProperty(value = "营销活动抵扣类型")
		private String deductPublicityType;
		@ApiModelProperty(value = "营销活动商品数量")
		private Integer deductPublicityGoodsNum;
		@ApiModelProperty(value = "营销活动是否支持优惠券")
		private Integer deductPublicityIsCoupon;
		@ApiModelProperty(value = "营销活动抵扣详情")
		private Map<String, Object> deductPublicityDetail;
		@ApiModelProperty(value = "实际支付")
		private Double orderPrice;
	}

	@Data
	public static class CouponVO implements Serializable {
		private static final long serialVersionUID = 1L;
		@ApiModelProperty(value = "主键")
		private Long id;
		@ApiModelProperty(value = "优惠券id")
		private Long couponId;
		@ApiModelProperty(value = "商户id")
		private Long sellerId;
		@ApiModelProperty(value = "优惠券名称")
		private String name;
		@ApiModelProperty(value = "优惠券简介")
		private String brief;
		@ApiModelProperty(value = "优惠券金额")
		private Double money;
		@ApiModelProperty(value = "最低消费，0代表不限制")
		private Double minPrice;
		@ApiModelProperty(value = "所属商品,分类id")
		private String primaryKey;
		@ApiModelProperty(value = "命中的primaryKey")
		private String targetKey;
		@ApiModelProperty(value = "使用类型")
		@ApiModelPropertyEnum(CouponUseTypeEnum.class)
		private Integer useType;
		@JsonFormat(pattern = DateUtil.PATTERN_DATE)
		@ApiModelProperty(value = "开始时间")
		private Date beginTime;
		@JsonFormat(pattern = DateUtil.PATTERN_DATE)
		@ApiModelProperty(value = "结束时间")
		private Date endTime;
		@ApiModelProperty(value = "描述信息")
		private String remark;
		@ApiModelProperty(value = "是否被选中")
		private Integer isSelect;
	}

}
